﻿namespace Arms.Framework.Loggers
{
    /// <summary>
    /// Generic logging factory that instantiates a logger.
    /// </summary>
    public static class LoggerFactory
    {
        private static ILoggerFactory _currentFactory = null;

        /// <summary>
        /// Sets the AppDomain's current logger factory.
        /// </summary>
        /// <param name="factory"></param>
        public static void SetCurrent(ILoggerFactory factory)
        {
            _currentFactory = factory;
        }

        /// <summary>
        /// Gets an instance of the AppDomain's current logger.
        /// </summary>
        public static ILogger Logger
        {
            get { return _currentFactory != null ? _currentFactory.Create() : null; }
        }
    }
}
